package com.tinyseed.emcp.api.basicdata.rest;

import com.tinyseed.emcp.api.basicdata.model.VenterpriseDeviceStatisticsOutput;
import com.tinyseed.emcp.api.basicdata.model.VrealtimeMonitorInputDTO;
import com.tinyseed.emcp.api.basicdata.model.VrealtimeMonitorOutputDTO;
import com.tinyseed.emcp.api.basicdata.service.VrealtimeMonitorService;
import com.tinyseed.hmxx.admin.security.utils.SecurityUtils;
import com.tinyseed.hmxx.admin.system.domain.dto.UserDTO;
import com.tinyseed.hmxx.admin.system.service.UserService;
import com.tinyseed.hmxx.common.base.BaseController;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/***
 * @ClassName: VrealtimeMonitorController
 * @Description: TODO
 * @Auther: Harlan.Xiong
 * @Date: 2019-12-23 19:05
 * @version : V1.0
 */

@Slf4j
@RestController
@RequestMapping("/realtimeMonitor")
public class VrealtimeMonitorController extends BaseController {

    @Autowired
    private VrealtimeMonitorService vrealtimeMonitorServicel;


    /**
     * 得到分页信息
     */
    @RequestMapping(value = "/page")
    @ResponseBody
    public ResponseEntity page(VrealtimeMonitorInputDTO request, int limit, int page) {

        Page result = vrealtimeMonitorServicel.page(request, limit, page);
        return new ResponseEntity<>(result, HttpStatus.OK);

    }

    /**
     * 获取企业经纬度
     *
     * @param request
     * @return
     */
    @RequestMapping(value = "/getPoint")
    @ResponseBody
    public ResponseEntity getPoint(VrealtimeMonitorInputDTO request) {
        List<VrealtimeMonitorOutputDTO> result = vrealtimeMonitorServicel.getPoint(request);
        return new ResponseEntity<>(result, HttpStatus.OK);

    }

    /**
     * 设备统计
     *
     * @return
     */
    @RequestMapping(value = "/getDeviceStatistics")
    @ResponseBody
    public ResponseEntity getDeviceStatistics() {
        VenterpriseDeviceStatisticsOutput result = vrealtimeMonitorServicel.getDeviceStatistics();
        return new ResponseEntity<>(result, HttpStatus.OK);

    }
}
